const fs = require('fs');
module.exports = {
  lintOnSave: false,
  devServer: {
    host: '0.0.0.0',
    port: 9999,
    https: {
      key: fs.readFileSync('../certs/key.pem'),
      cert: fs.readFileSync('../certs/cert.pem'),
    },
  },
  filenameHashing: true,
  chainWebpack: config => {
    config.output.filename = '[name].[contenthash].js'; // 设置 JS 文件名
    config.output.chunkFilename = '[name].[contenthash].js'; // 设置 chunk 文件名
    const scssRule = config.module.rule('scss')
    // 你可以在这里添加或修改 loader
    scssRule.oneOf('vue')
    .use('sass-loader')
    .loader('sass-loader')
    .tap(options => ({
      ...options,
      // 额外的配置
    }))
  },
  configureWebpack: {
    optimization: {
      splitChunks: {
        chunks: 'all',
        maxSize: 500 * 1024,  // 设置拆分大小阈值
        // maxInitialRequests: 5,
        automaticNameDelimiter: '-',
      }
    }
  }
};
